package com.lamatek.tags.google;

import javax.servlet.ServletRequest;

/**
 * GoogleMapEventHandler
 * 
 * This interface defines the behaviour of classes that receive GoogleMaps events.
 * Developers should not override this interface, but Objects that are used to
 * handle events should either implement this interface or (better yet) extend
 * the DefaultEventListenerBean or DefaultEventListenerServlet.
 * 
 * @author Tom Cole
 * @version 0.40
 */
public interface GoogleMapEventHandler {
    
    /**
     * This method is called after all the event based methods have been called.
     * Developers can use this method to handle non-event based requests.
     * 
     * The default implementation is empty to there is no need to call
     * super.process().
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param request The original ServletRequest.
     */
    public void process(GoogleMapTag map, ServletRequest request);
    /**
     * This method is called if a click event is detected that was generated
     * by an overlay (box, circle, marker, polygon, polyline).
     * 
     * The default implementation is empty so there is no need to call
     * super.processMarkerClickEvent().
     * 
     * @param map The GoogleMapTag parent of the marker clicked.
     * @param id The id of the overlay that was clicked.
     * @param type The type of overlay clicked (marker, box, circle, polygon, polyline)
     */
    public void processOverlayClickEvent(GoogleMapTag map, String id, String type);
    /**
     * This method is called when a click event is detected that was generated
     * by a GoogleMapTag (&lt;googlemaps:map>).
     * 
     * The default implementation of this method is empty so there is no need
     * to call super.processClickEvent().
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param longitude The longitude (in decimal form) where the click occured.
     * @param latitude The latitude (in decimal form) where the click occured.
     */
    public void processClickEvent(GoogleMapTag map, double longitude, double latitude);
    /**
     * This method is called when a double-click event is detected that was
     * generated by an overlay (box, circle, marker, polygon, polyline).
     * 
     * The default implementation of this method is empty so there is no need
     * to call super.processMarkerDoubleClickEvent().
     * 
     * @param map The GoogleMapTag parent of the marker double-clicked.
     * @param id The id of the overlay double-clicked.
     * @param type The type of overlay double-clicked (marker, circle, box, polygon, polyline)
     */
    public void processOverlayDoubleClickEvent(GoogleMapTag map, String id, String type);
    /**
     * This method is called when a double-click event is detected that was
     * generated by a GoogleMapTag (&lt;googlemaps:map>).
     * 
     * The default implementation of this method is empty so there is no
     * need to call super.processDoubleClickEvent().
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param longitude The longitude (in decimal form) where the double-click occured.
     * @param latitude The latitude (in decimal form) where the double-click occured. 
     */
    public void processDoubleClickEvent(GoogleMapTag map, double longitude, double latitude);
    /**
     * This method is called when a zoom event is detected.
     * 
     * The default implementation of this method simulates the default behaviour of
     * a Google Map and any subclasses should call super.processZoomEvent() to 
     * ensure consistent behaviour.
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param zoom The new requested zoom level.
     */
    public void processZoomEvent(GoogleMapTag map, int zoom);
    /**
     * This method is called when a moveend event is detected.
     * 
     * The default implementation of this method simulates the default behaviour of
     * a Google Map and any subclasses should call super.processMoveEndEvent() to 
     * ensure consistent behaviour.
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param longitude The new center longitude (in decimal form).
     * @param latitude The new center latitude (in decimal form).
     */
    public void processMoveEndEvent(GoogleMapTag map, double longitude, double latitude);
    /**
     * This method is called when a maptypechanged event is detected.
     * 
     * The default implementation of this method simulates the default behaviour of
     * a Google Map and any subclasses should call super.processMapTypeChangedEvent() to 
     * ensure consistent behaviour.
     * 
     * @param map The GoogleMapTag that generated the event.
     * @param type The new requested map type (map | satellite | hybrid).
     */
    public void processMapTypeChangedEvent(GoogleMapTag map, String type);

}
